package org.jeecg.modules.demo.task.email;

import org.jeecg.modules.demo.crm.entity.CPaymentStatistics;
import org.jeecg.modules.demo.crm.entity.CProjectApplication;
import org.jeecg.modules.demo.crm.mapper.CInvoiceApplyMapper;
import org.jeecg.modules.demo.crm.mapper.CPaymentInvoiceMapper;
import org.jeecg.modules.demo.crm.mapper.CPaymentStatisticsMapper;
import org.jeecg.modules.demo.crm.mapper.CProjectApplicationMapper;
import org.jeecg.modules.demo.crm.service.ICEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 邮件发送
 */
@Component
@ConditionalOnProperty(name = "msg.enable", havingValue = "true")
public class EmailScheduledTask {

    @Autowired
    private CProjectApplicationMapper projectApplicationMapper;
    @Autowired
    private ICEmailService cEmailService;

    // 每天早上8点到晚上8点期间每20分钟执行一次任务
    @Scheduled(cron = "0 0/20 8-20 * * ?")
    public void executeTask() {
        //10分钟检测一次，是否有待发送的邮件
        cEmailService.taskEMail();
    }

}
